<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Real Property and Business Permit</title>
<meta name="keywords" content="" />
<meta name="description" content="" />
<link href="styles.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="nivo-slider.css" type="text/css" media="screen" />
</head>
<body>
<div id="bg">
<div id="logo">
<img src="images/logo_and_name.png" alt="" width="305" height="78" />
</div>
<div id="main">

<!-- content begins -->
<div id="content_bg">
 
    <div class="TPName" id="TPName">
    <left><h2>Change Business Location</h2></left>
    <p>
    <?php 
		$x=$_GET['BID']; 
		$db_name = "thesis_bis";
	$table_name = "business";

	$user = "root";
	$pass = "";
	
	$connection = mysql_connect("localhost","$user","$pass")
	or die(mysql_error());

	$db = mysql_select_db($db_name, $connection) or die(mysql_error());

	$sql = "SELECT * FROM $table_name where BID = '$x' ";

	$result = mysql_query($sql, $connection) or die(mysql_error());

	$num= mysql_num_rows($result);
   
    if($num<1)
	{
		$display_block = "<p><em>Empty...</em> </p>";
	}
	else
	{
	$number=0;
	while ($row = mysql_fetch_array($result))

	{   
	 
		$number++;
		$BID = $row['BID'];
		$BHouseNo=$row['BHouseNo'];
		$BUnitNo=$row['BUnitNo'];
		$BStreet=$row['BStreet'];
		$BBrgy=$row['BBrgy'];
		$BSubd=$row['BSubd'];
		$BMunicipality=$row['BMunicipality'];
 		$BProvince=$row['BProvince'];    
		
		
    }
	}
    ?>
    </p>
  
  <table width="400" height="200" border="1" align="left" class="table1">
          <form action="<?php echo $_SERVER['PHP_SELF'];?>" method="post">
        <input type="hidden" name="BID" id="BIDtext" value="<?php echo $BID; ?>">
        <tr><th>
        
        </th>
        <th>
        <font color="#000000"><strong>Current Information</strong></font></th>
        <th>
        <font color="#000000"><strong>Enter New Information</strong></font></th>
        </tr>
          <tr>
            <th class="table1" width="153">Business Location:</th>
            <td class="table1" width="176">
            <td class="table1" width="253">
              <label>
                </label></td>
          </tr>
          
          <tr>
            <td class="table1" >House No./Building No.Building Name:</td>
            <td class="table1" ><font color="#000000" size="3"><strong><?php echo "$BHouseNo"; ?></strong></font></td>
            <td class="table1"><input type="text" name="BHouseNo" id="textfield2" value="<?php echo "$BHouseNo"; ?>"></td>
          </tr>
          
           <tr>
            <td class="table1" >Unit No:</td>
            <td class="table1" ><font color="#000000" size="3"><strong><?php echo "$BUnitNo"; ?></strong></font></td>
            <td class="table1"><input type="text" name="BUnitNo" id="textfield2" value="<?php echo "$BUnitNo"; ?>"></td>
          </tr>
          
            <tr>
            <td class="table1" >Street:</td>
            <td class="table1" ><font color="#000000" size="3"><strong><?php echo "$BStreet"; ?></strong></font></td>
            <td class="table1"><input type="text" name="BStreet" id="textfield2" value="<?php echo "$BStreet"; ?>"></td>
          </tr>
          
            <tr>
            <td class="table1" >Barangay:</td>
            <td class="table1" ><font color="#000000" size="3"><strong><?php echo "$BBrgy"; ?></strong></font></td>
            <td class="table1"><input type="text" name="BBrgy" id="textfield2" value="<?php echo "$BBrgy"; ?>"></td>
          </tr>
          
          <tr>
            <td class="table1" >Subdivision:</td>
            <td class="table1" ><font color="#000000" size="3"><strong><?php echo "$BSubd"; ?></strong></font></td>
            <td class="table1"><input type="text" name="BSubd" id="textfield2" value="<?php echo "$BSubd"; ?>"></td>
          </tr>
          
            <tr>
            <td class="table1" >Municipality:</td>
            <td class="table1" ><font color="#000000" size="3"><strong><?php echo "$BMunicipality"; ?></strong></font></td>
            <td class="table1"><input type="text" name="BMunicipality" id="textfield2" value="<?php echo "$BMunicipality"; ?>"></td>
          </tr>
          
          <tr>
            <td class="table1" >Province:</td>
            <td class="table1" ><font color="#000000" size="3"><strong><?php echo "$BProvince"; ?></strong></font></td>
            <td class="table1"><input type="text" name="BProvince" id="textfield2" value="<?php echo "$BProvince"; ?>"></td>
          </tr>
          
          
          <td>&nbsp;</td>
            <td><input type="hidden" name="id" value="<?php echo $_GET['BID'];?>"></td>
            <td><label>        
            <input name="btn_submit2" type="submit" class="icon" id="button" onClick="return validate()" value="Submit">
            </label></td>
          </tr>  
          </form>  
      </table>
      
      <?php
		
		if(isset($_POST['btn_submit2']))
		   {

	
	$db_name = "thesis_bis";
	$table_name = "business";
	$user = "root";
	$pass = "";
	$connection = mysql_connect("localhost","$user","$pass")
	or die(mysql_error());
	$db = mysql_select_db($db_name, $connection) or die(mysql_error());
	
	$sql = "UPDATE $table_name SET BHouseNo = '$_POST[BHouseNo]' ,BUnitNo = '$_POST[BUnitNo]',BStreet = '$_POST[BStreet]',BBrgy = '$_POST[BBrgy]',BSubd = '$_POST[BSubd]',BMunicipality = '$_POST[BMunicipality]',BProvince = '$_POST[BProvince]' WHERE BID = '$_POST[BID]'";
	
	$result = mysql_query($sql, $connection) or die(mysql_error());
	echo "BUSINESS LOCATION SUCCESSFULLY UPDATED!";
	
}
?>

    </div>

</div>
<!-- content ends -->
<!-- footer begins -->
<div id="footer">
   <a href="http://validator.w3.org/check?uri=referer">Copyrights © 2012</a> | <a href="http://guinobatan.gov.ph/index.php/guinobatan/index">Municipality of Guinobatan</a>. | All rights reserved. 
      </p></div>
<!-- footer ends -->
</div>
</div>
</body>
</html>